package org.hawk.gwt.ppc.parser.impl;

import java.util.List;

import org.hawk.gwt.ppc.parser.AnnotationDescriptor;
import org.hawk.gwt.ppc.parser.ExpressionDescriptor;
import org.hawk.gwt.ppc.parser.FieldDescriptor;

/**
 * Implementation for {@link FieldDescriptor}.
 * 
 * @author alex.bereznevatiy@gmail.com
 *
 */
final class FieldDescriptorImpl extends AbstractDescriptor implements
		FieldDescriptor {

	private String name;
	private String type;
	private List<String> modifiersList;
	private List<AnnotationDescriptor> annotations;
	private ExpressionDescriptor initializer;
	
	FieldDescriptorImpl(String name, String type, List<AnnotationDescriptor> annotations,
			List<String> modifiersList, ExpressionDescriptor initializer) {
		this.name = name;
		this.type = type;
		this.modifiersList = unmodify(modifiersList);
		this.annotations = unmodify(annotations);
		this.initializer = initializer;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.VariableDescriptor#getName()
	 */
	public String getName() {
		return name;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.VariableDescriptor#getType()
	 */
	public String getType() {
		return type;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.ModificatedDescriptor#getModifiers()
	 */
	public List<String> getModifiers() {
		return modifiersList;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.FieldDescriptor#getInitializer()
	 */
	public ExpressionDescriptor getInitializer() {
		return initializer;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.parser.AnnotatedDescriptor#getAnnotations()
	 */
	public List<AnnotationDescriptor> getAnnotations() {
		return annotations;
	}
}
